<!doctype html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"><!--<![endif]-->
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title><g:layoutTitle default="Grails"/></title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<link rel="shortcut icon" href="${resource(dir: 'images', file: 'favicon.ico')}" type="image/x-icon">
		<link rel="apple-touch-icon" href="${resource(dir: 'images', file: 'apple-touch-icon.png')}">
		<link rel="apple-touch-icon" sizes="114x114" href="${resource(dir: 'images', file: 'apple-touch-icon-retina.png')}">
		<link rel="stylesheet" href="${resource(dir: 'css', file: 'main.css')}" type="text/css">
		<link rel="stylesheet" href="${resource(dir: 'css', file: 'mobile.css')}" type="text/css">
		<link rel="stylesheet" href="${resource(dir: 'css/blitzer', file: 'jquery-ui-1.8.21.custom.css')}" type="text/css">
		<link rel="stylesheet" href="${resource(dir: 'css/blitzer', file: 'jquery.dataTables.css')}" type="text/css">
		<link rel="stylesheet" href="${resource(dir: 'css/blitzer', file: 'jquery.dataTables_themeroller.css')}" type="text/css">
		<g:javascript library="jquery" src="jquery/jquery-1.7.1.min.js"/>
		<g:javascript src="jquery-ui/jquery-ui-1.8.16.custom.min.js"/>
		<g:javascript src="datatables/jquery.dataTables.min.js"/>
		<g:javascript src="datatables/jquery.dataTables.js"/>
		<g:javascript src="jquerySetup.js"/>
		<g:layoutHead/>
        <r:layoutResources />
	</head>
	<body>
		<div id="grailsLogo" role="banner">
			<div id="bannerHolder"><a href="/com.storeselector.storemanagement"><img src="${resource(dir: 'images', file: 'storeSelectorHeader.PNG')}" alt="Grails"/></a></div>
			<sec:ifLoggedIn>
				<div id="currStore">			
					Current Store: 
					<g:if test="${com.storeselector.storemanagement.Store.all.size() > 0 }"> 
						${com.storeselector.storemanagement.Store.all.sort{it.id}.get(0).name }
					</g:if>
					<g:else>None</g:else>
				</div>
				<div id="welcomeUser">
					<span>Welcome, <sec:username/>&nbsp;<g:link controller='logout'>Logout</g:link></span>
				</div>
			</sec:ifLoggedIn>
		</div>
		<div id="bodyContainer">
			<div id="leftNav" class="leftNav">
				<sec:ifLoggedIn>
					<dl>
						<dt>Manage Stores</dt>
							<dd><g:link controller="store" action="create">Create Store</g:link>
							<dd><g:link controller="store" action="list">View My Stores</g:link></dd>
						<dt>Manage Inventory</dt>
							<g:if test="${com.storeselector.storemanagement.Store.all.size() > 0 }">
								<g:each var="store" in="${com.storeselector.storemanagement.Store.all.sort{it.id}}">
									<dd><g:link controller="product" action="listByStore" params="[storeId: store.id]">${store.name }</g:link></dd>
								</g:each>
							</g:if>
							<g:else>
								<dd>No Inventory!</dd>
							</g:else>
						<dt>Manage Deals</dt>
							<dd>No Deals!</dd>
					</dl>
				</sec:ifLoggedIn>
				<sec:ifNotLoggedIn>
					<span>Please Login!</span>
				</sec:ifNotLoggedIn>
			</div>
			<div id="contentContainer">
				<g:layoutBody/>
				<div id="spinner" class="spinner" style="display:none;"><g:message code="spinner.alt" default="Loading&hellip;"/></div>
			</div>
			<div class="footer" role="contentinfo"></div>
		</div>
		<g:javascript library="application"/>
        <r:layoutResources />
	</body>
</html>